<template>
  <el-button @click="add">{{ count }}</el-button>
</template>

<script lang="ts" setup>
import xjhRequest from '@/service/index';
import { ref } from 'vue';
interface DataType {
  data: any;
  status: boolean;
}

const count = ref(0);

const add = () => {
  count.value++;
  xjhRequest
    .get<DataType>({
      url: '/moment',
      params: {
        pageSize: 5,
        pageNum: 1
      },
      interceptors: {
        requestInterceptor: (config) => {
          // console.log('myself', config);
          return config;
        },
        responseInterceptor: (res) => {
          // console.log('myself', res);
          return res;
        }
      },
      // 可选参数感觉还是很重要的一个操作
      showLoading: true
    })
    .then((res) => {
      console.log(res);
    });
};
</script>
